home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 August / Software of the Month Club 1996 August.iso / pc / dos / edu / mapit14c / mapitc.pak / GPS_UTIL.TXT < prev    next >
Encoding:
Text File  |  1994-04-15  |  20.5 KB  |  438 lines

  1.                         MAPIT GPS Utilities Package
  2.                                  Version 1.0
  3.  
  4.                       Copyright 1994 John B. Allison
  5.  
  6.                              Allison Software
  7.                               166 Shady Lane
  8.                             Apollo, PA  15613
  9.  
  10.    412-727-2198    CIS: 72600,1200    Internet: 72600.1200@compuserve.com
  11.  
  12.  
  13. Allison Software's MAPIT GPS Utilities Package is a set of IBM-compatible 
  14. PC programs designed to capture NMEA 0183 data from a Global Positioning 
  15. System receiver saving it to computer disk for later transformation into 
  16. mapping coordinate data for display and use by MAPIT.  The Global 
  17. Positioning System (GPS) consists of 24 satellites maintained by the US 
  18. Department of Defense.  Signals transmitted from these satellites are 
  19. encoded with precise location and timing information which enable users 
  20. with GPS receivers to determine their location anywhere in the world with 
  21. 100 meter accuracy. 
  22.  
  23. The MAPIT GPS Utilities allow one to capture real-time positioning data 
  24. from the output of a GPS receiver through a serial COM port of a computer, 
  25. save it to a disk file, and later convert that data from its original NMEA 
  26. 0183 sentence format to ASCII lat/long coordinates.  The program GPSTONME 
  27. saves the GPS data to disk while NMETOMP1 processes the raw data converting 
  28. it to .MP1 format.  A third program, MP1TOMP3, converts the ASCII .MP1 data 
  29. to MAPIT's binary .MP3 format, completing the sequence.
  30.  
  31.  
  32. GPSTONME:
  33.  
  34. GPSTONME is part of the MAPIT GPS Utility Package designed to capture data 
  35. from the output of a GPS (Global Positioning System) receiver and save it 
  36. to a computer file for later processing and conversion to mapping data.
  37.  
  38. This program expects GPS output in the form of NMEA 0183 Version 2 
  39. sentences supplied at 4800 baud at serial COM port 1 - 4 of an 
  40. IBM-compatible computer.  (See Appendix I for port pin configuration.)
  41.  
  42. Once operating, GPSTONME notifies the user when the data signal is 
  43. acquired, dropped, or missing, saves incoming data to an ASCII file, 
  44. periodically updates the file system's FAT to reduce data loss due to 
  45. computer battery failure, and optionally resets the computer's system clock 
  46. to agree with the time supplied by the GPS.
  47.  
  48. GPSTONME is run from the DOS command line and expects zero or more of the 
  49. following options:
  50.  
  51.    gpstonme    [data_file]   [command_line_options]
  52.  
  53. data_file
  54.         
  55.         The name of an output file in which the raw GPS NMEA 0183 data sentence 
  56.         are to be stored.  This ASCII file is defaulted with the extension 
  57.         ".NME" if none is specified.  If no data file name is specified, 
  58.         GPSTONME stores the data in a file whose name is generated as part of a 
  59.         series beginning with the year, month, and day of the month of today's 
  60.         date to which is appended the numbers 01, 02, ... 99 to make the name 
  61.         unique.  Using self- generated names, the files created on February 28, 
  62.         1994 would be named 94022801.NME, 94022802.NME, etc.
  63.  
  64.         If you want to direct output to the screen, use the special DOS name 
  65.         "CON" which indicates the console and add the command line argument 
  66.         /overwrite to allow output to an already-existing "file".
  67.  
  68. /noclockset
  69.  
  70.         By default, GPSTONME updates the computer's system clock to reflect the 
  71.         minutes and seconds as they're delivered real-time from the GPS unit.  
  72.         The hour is not changed in order to protect the local time offset from 
  73.         the Universal Time delivered by the GPS except when the corrected 
  74.         minutes advance or retreat over the hour mark.  Even that exception is 
  75.         excepted at the start of a new day.  Time corrections are not applied 
  76.         near midnight to avoid the necessity of changing the computer's 
  77.         calendar day and possibly year.
  78.  
  79.         Time corrections are applied only when the computer's minutes and 
  80.         seconds are within 10 minutes of the GPS's UT.  A message tells the 
  81.         user the difference between these two times and whether the computer's 
  82.         clock has been reset.  The user must reset the computer manually with 
  83.         the TIME command to the approximate time if the time difference is too 
  84.         great for automatic update.
  85.  
  86.         The option /noclockset overrides the automatic resetting of the 
  87.         computer's clock.
  88.  
  89. /nocommit
  90.  
  91.         By default, GPSTONME updates the FAT (File Access Table) of the output 
  92.         file every minute or two as it writes the file to disk.  GPSTONME does 
  93.         this because, in event of a power failure or system crash, a data file 
  94.         whose FAT is not updated will not be "saved" although data may have 
  95.         been written to the disk all day long.  During real-time data capture, 
  96.         one gets a warm fuzzy feeling knowing that all except the last minute 
  97.         or two of his data is safe in the unlikely event lightening does strike.
  98.  
  99.         Data commits also happen when data stops appearing at the COM port and 
  100.         the program issues an informational warning message and when the user 
  101.         types "c" at the keyboard.
  102.  
  103.         If you don't want this automatic update of the FAT to occur, enter 
  104.         /nocommit as a command line argument.
  105.  
  106. /overwrite
  107.  
  108.         GPSTONME normally gives an error message and doesn't permit the 
  109.         overwriting and destruction of an existing data file by a new one.  The 
  110.         /overwrite option allows a file name to be reused.  The old file is 
  111.         first truncated.  Its data is all destroyed.  Use with care.
  112.  
  113. /port=n
  114.  
  115.         GPSTONME expects the GPS to be connected to the computer's COM1 serial 
  116.         port.  The /port option allows any one of the four ports, 1 through 4, 
  117.         to be selected at program run time.  Note that GPSTONME automatically 
  118.         configures the selected port to the correct baud rate, parity, and stop 
  119.         bits.
  120.  
  121. /?
  122.  
  123.         This option displays a brief explanation of all command line options on 
  124.         the screen.
  125.  
  126. The foregoing command line options can be truncated to the point of 
  127. ambiguity without error.  (e.g. /p=3 is acceptable as is /port=3.) Possible 
  128. matches are listed in case of ambiguous input.  You can use this fact to 
  129. force the program to remind you of all possible command line options by 
  130. entering just a "/".
  131.  
  132. GPSTONME does not respond to keyboard input except for selected commands:
  133.  
  134.         c - commit.  Force update of the output file's FAT unless the /nocommit 
  135.                 is in effect.
  136.  
  137.         v - version.  Displays version number, copyright notice, and author's 
  138.                 address.
  139.  
  140.         <Esc> y - exit.  Terminate processing.
  141.  
  142. Please note: The serial COM ports are unbuffered and are open to data 
  143. overrun errors unless special buffered drivers are used.  GPSTONME uses 
  144. standard BIOS calls and may therefore drop characters upon occasion.  This 
  145. means that GPSTONME must be run as a single task and cannot be multi-tasked 
  146. as a Window's background process.  From a practical perspective, there is 
  147. enough redundant and unused data to make the occasional loss of a few 
  148. characters inconsequential.  The next down-stream program, NMETOMP1, is 
  149. designed with extensive error checking to weed out "bad" data fields or 
  150. sentences.  Commits and keyboard checking are done at the end of time-outs 
  151. when the likelihood of incoming data and therefore data overruns is reduced.
  152.  
  153.  
  154. NMETOMP1:
  155.  
  156. NMETOMP1 is the part of the MAPIT GPS Utility Package designed to convert 
  157. and process raw NMEA 0183 Version 2 sentence data saved on disk by the GPS 
  158. Utility program GPSTONME and save it to an ASCII lat/long .MP1 format file.
  159.  
  160. Beyond straight format conversion, NMETOMP1 provides a great deal of error 
  161. checking, the coalescing of data partially and multiply defined by a sets 
  162. of NMEA sentences generated from a single fix, the dropping of duplicate 
  163. points, simple data smoothing, and the pruning of unneeded points.
  164.  
  165. NMETOMP1 is run from the DOS command line and expects the following options:
  166.  
  167.    nmetomp1    input_file  [output_file]   [command_line_options]
  168.  
  169. input_file
  170.  
  171.         The required input data file name.  The input file must be an ASCII 
  172.         NMEA sentence file whose extension, unless otherwise specified, 
  173.         defaults to ".NME".
  174.  
  175. output_file
  176.  
  177.         An optional name for the ASCII .MP1 formatted output file.  If no 
  178.         extension is specified, the default extension ".MP1" is used.  If no 
  179.         output_file is specified, the input_file name with the extension ".MP1" 
  180.         is used for output.
  181.  
  182. /average
  183. /avg
  184.  
  185.         Apply a simple smoothing algorithm to the data.  Averaging is 
  186.         accomplished after duplicate points are removed and minimum spacing is 
  187.         determined.  /average has no noticeable effect on the display of data 
  188.         by MAPIT unless the /minxx=spacing option is applied with a spacing 
  189.         value greater than the 100 foot resolution of MAPIT's ability to 
  190.         reproduce data.  See Precision versus Accuracy below for a related 
  191.         discussion.
  192.  
  193. /decimals=n
  194.  
  195.         The required number of places of precision after the decimal point for 
  196.         latitude, longitude, and time input data.  Defaults to 2.  A value of 0 
  197.         requires none but allows data after the decimal point.  The primary 
  198.         purpose of this option is to allow for the further checking for dropped 
  199.         data to the right of the decimal which are not spelled out in the NMEA 
  200.         specification.  Because the exact precision of your data is GPS 
  201.         vendor-dependent, you may want to examine the raw data and adjust this 
  202.         option accordingly.  As an example, specifying /decimals=1 will cause 
  203.         the otherwise correctly formatted time field "120156" in vendor X's GLL 
  204.         statement to be logged as an error but is not an overall debilitating 
  205.         error if the time is available from another sentence.  Some compromise 
  206.         toward less stringent error checking may be necessary.  (This is a 
  207.         fine-tuning option.  If it works, don't fool unless the output shows 
  208.         too many bad points.) See /error below.
  209.  
  210. /duplicates
  211.  
  212.         Don't drop duplicate points but convert all data.  By default, NMETOMP1 
  213.         doesn't convert duplicate points: points taken within half a time 
  214.         second of the previous point or located within a distance of the last 
  215.         point implied by /decimals above (applied to the location expressed in 
  216.         minutes: e.g. /decimals=2 implies a minimum separation of 0.01 
  217.         minutes).  Duplicate points can be created as the GPS looses signal 
  218.         acquisition, in which case the last fix may be retransmitted a number 
  219.         of times, or when physical movement of the GPS ceases.
  220.  
  221. /error
  222.  
  223.         Log parsing error messages in output_file.ERR.  Errors are normally due 
  224.         to characters dropped by the unbuffered input.
  225.  
  226. /minfeet=n
  227. /minft=n
  228. /minmeters=n
  229. /minkmeters=n
  230. /minmiles=n
  231. /minnmiles=n
  232.  
  233.         Prune (drop) points to support a precision of n feet, meters, 
  234.         kilometers, miles, or nautical miles.  GPS fixes can be downloaded as 
  235.         often as every second or two resulting in a huge number of points which 
  236.         may be too close together to be warranted by a particular application.  
  237.         One of the main strengths of NMETOMP1 is the program's ability to 
  238.         reduce the number of points to meet the user's criteria of data spacing 
  239.         and accuracy.  The pruning algorithm consists of two parts: fixes which 
  240.         are within the stated distance n of the last fix are dropped as being 
  241.         obviously unnecessary.  Also intermediate points falling within a 
  242.         straight line corridor 2n wide between the last accepted fix (anchor 
  243.         point) and the next necessary one are themselves unnecessary.  A 
  244.         dramatic reduction in data is possible by specifying a minimum 
  245.         precision of even 500 feet.  (Remember that S/A - see below - reduces 
  246.         the accuracy of any given fix to +/-300 feet with a 95% probability.)
  247.  
  248. /unsupported
  249.  
  250.         Log unsupported NMEA sentences in output_file.ERR Unsupported NMEA 
  251.         sentences are those of which NMETOMP1 is not aware.  They neither hurt 
  252.         nor are interpreted.  (See Appendix II for a list of supported 
  253.         sentences.)
  254.  
  255. /?
  256.  
  257.         This option displays a brief explanation of all command line options on 
  258.         the screen.
  259.  
  260. The foregoing command line options can be truncated to the point of 
  261. ambiguity without error.  (e.g. /minkm=3 is acceptable as is 
  262. /minkmeters=3.) Possible matches are listed in case of ambiguous input.  
  263. You can use this fact to force the program to remind you of all possible 
  264. command line options by entering just a "/".
  265.  
  266.         
  267. Example Input/Output:
  268.  
  269. Two samples of data input and one of data output are listed below.  The 
  270. data input, although conforming to the NMEA 0183 version 2.00 
  271. specification, can vary from GPS to GPS because of the variety of sentences 
  272. available, their ordering, data precision, and dropped elements.  
  273.  
  274. The input listed below is from a Magellan GPS Meridian, a less expensive if 
  275. not popular hand- held GPS.  The Meridian supports three different types of 
  276. NMEA output chosen from deep within its menuing system (Aux Menu, second 
  277. page, NMEA): 0183A, 0813B, and 0813C.  The 0813A uses NMEA sentences from a 
  278. prior standard no longer recommended for use and is not supported by 
  279. NMETOMP1.  0813B's output is shown in Sample Input A, and 0813C's output is 
  280. shown in Sample Input B.  Note that in both cases a single fix gives rise 
  281. to multiple sentences which may contain redundant data.  (See Appendix II 
  282. for a list of required and supported sentences.) In the Meridian examples, 
  283. 0813C (Sample Input B) gives more data unless you require that the date be 
  284. included.  On the other hand, Sample A's data carries mandatory checksums 
  285. for data accuracy.
  286.  
  287. Sample Input A:
  288.  
  289. $GPRMB,A,0.02,L,0008,0009,4027.05,N,07935.27,W,003.9,162.,00.0,V*21
  290. $GPRMC,200150,A,4030.81,N,07936.83,W,00.0,000.0,150394,08.,W*4C
  291. $GPRMB,A,0.01,L,0008,0009,4027.05,N,07935.27,W,003.9,162.,00.0,V*22
  292. $GPRMC,200156,A,4030.80,N,07936.83,W,00.0,000.0,150394,08.,W*4B
  293. $GPRMB,A,0.01,L,0008,0009,4027.05,N,07935.27,W,003.9,162.,00.0,V*22
  294. $GPRMC,200157,A,4030.80,N,07936.83,W,00.0,000.0,150394,08.,W*4A
  295.  
  296. Sample Input B:
  297.  
  298. $GPGLL,4030.899,N,07936.455,W,012611.861,A
  299. $GPAPB,A,A,0.3,R,N,V,V,162.7,T,009,166.8,T,85.3,T
  300. $GPGGA,012611.86,4030.90,N,07936.46,W,1,07,4.1,,,,,, 
  301. $GPVTG,81.5,T,89.9,M,2.7,N,5.0,K
  302. $GPBWC,012611.86,4027.05,N,07935.27,W,166.8,T,175.2,M,4.0,N,009
  303. $GPGLL,4030.910,N,07936.449,W,012615.921,A
  304. $GPAPB,A,A,0.3,R,N,V,V,162.7,T,009,166.9,T,160.9,T
  305. $GPGGA,012615.92,4030.91,N,07936.45,W,1,07,5.1,,,,,,
  306. $GPVTG,6.0,T,14.4,M,8.2,N,15.2,K
  307. $GPBWC,012615.92,4027.05,N,07935.27,W,166.9,T,175.3,M,4.0,N,009
  308. $GPGLL,4030.936,N,07936.449,W,012621.369,A
  309. $GPAPB,A,A,0.3,R,N,V,V,162.7,T,009,167.0,T,173.6,T
  310. $GPGGA,012621.37,4030.94,N,07936.45,W,1,07,3.9,,,,,,
  311. $GPVTG,353.4,T,1.8,M,22.7,N,42.1,K
  312. $GPBWC,012621.37,4027.05,N,07935.27,W,167.0,T,175.3,M,4.0,N,009
  313.  
  314. Note:   GPAPB Autopilot Sentence "B"  -  unsupported .
  315.         GPBWC Bearing & Distance to Waypoint  -  unsupported.
  316.  
  317. Sample Output:
  318.  
  319.         1       2   3       4       5   6   7      8        9
  320.  40.514983  -79.607583      0 012611.861UT 000000  81.5   5.0km/hr  4.1  7
  321.  40.515167  -79.607483      0 012615.921UT 000000   6.0  15.2km/hr  5.1  7
  322.  40.515600  -79.607483      0 012621.369UT 000000 353.4  42.1km/hr  3.9  7
  323.  
  324.         1 - Latitude in decimal degrees.  Negative implies south.
  325.  
  326.         2 - Longitude in decimal degrees.  Negative implies west.
  327.  
  328.         3 - Altitude in meters above sea level.
  329.  
  330.         4 - Universal Time (GMT) HHMMSS.SSS
  331.  
  332.         5 - Date at the Prime Meridian.  DDMMYY
  333.  
  334.         6 - True course made good.
  335.  
  336.         7 - Speed over ground in kilometers per hour.
  337.  
  338.         8 - Horizontal dilution of precision.
  339.  
  340.         9 - Number of satellites in use (versus in view).  0 - 12.
  341.  
  342.  
  343. The format of this output, known as .MP1 by Allison Software, is not 
  344. precisely defined.  The program MP1TOMP3 converts the first two columns, 
  345. the latitude and longitude, to .MP3 format and treats all following text as 
  346. comments.  Whether there are adjustments in the following columns as GPS 
  347. data conversion evolves remains to be seen.  The data is defined in terms 
  348. of the order of white space-separated characters groups and not by absolute 
  349. column position.
  350.  
  351.         
  352. Example Data Collection/Reduction Session:
  353.  
  354. The following DOS commands illustrate the collection and use of GPS data 
  355. using Allison Software's GPS Utilities.
  356.  
  357. Collect GPS output in an ASCII file named APOLOOP.NME.  This scenario 
  358. presupposes a GPS receiver properly connected to the COM1 port of portable 
  359. computer collecting meaningful data as you drive down a highway or sail 
  360. across a lake.  Non-meaningful stationary data will work for debugging 
  361. purposes.
  362.  
  363.         C:> gpstonme  apoloop
  364.             Esc Y             ; exit program
  365.  
  366. Convert the raw data found in APOLOOP.NME to .mp1 format in the file 
  367. APOLOOP.MP1.  The informational message at the program's conclusion tells 
  368. you that 785 fixes are output out of a possible 785 (All unique data was 
  369. transferred) and that there are 76 errors found in the 4,473 NMEA source 
  370. lines.
  371.  
  372.         C:> nmetomp1  apoloop
  373.  
  374.                   785 fixes output out of 785.  76 errors in 4473 lines.
  375.  
  376. Create a second .mp1 file with a minimum separation of 500 feet between 
  377. points.  Notice the use of a second file name to, in effect, rename the 
  378. output to a name different from the input.  There are only 92 out of 785 
  379. fixes transfered because of the effect of the /minft=500 pruning.
  380.  
  381.         C:> nmetomp1  apoloop  apoloop2  /minft=500
  382.  
  383.                   92 fixes output out of 785.  76 errors in 4473 lines.
  384.  
  385. Convert both these .mp1 files to .mp3 format for use display in MAPIT.  
  386. Place the first on white layer 120, and the second on red layer 124.
  387.  
  388.         C:> mp1tomp3  apoloop  /layer=120
  389.         C:> mp1tomp3  apoloop2  /lay=124
  390.  
  391. Display them both in MAPIT so that the 500 foot red layer overwrites the 
  392. white layer.
  393.  
  394.         C:> mapit  apoloop  /extended=apoloop2
  395.  
  396. As you zoom in, you'll be able to see which points from the original data 
  397. were pruned.
  398.  
  399. Run NMETOMP1 with the /avg option to show the results of averaging points.  
  400. Create a third file using the same minimum spacing of 500 feet but with the 
  401. averaging option.  Compare this file with the 500 foot file with no 
  402. averaging.
  403.  
  404.         C:> nmetomp1  apoloop  apoloop3  /minft=500  /avg
  405.         C:> mp1tomp3  apoloop3  /layer=122
  406.         C:> mapit  apoloop2  /extended=apoloop3
  407.  
  408.         
  409. Precision versus Accuracy:
  410.  
  411. The old conundrum of precision versus accuracy raises its confusing head 
  412. again in the case of MAPIT-displayed GPS data.  MAPIT is able to store 
  413. points within approximately 100 feet of a location.  In other words, a 
  414. point whose location should be at x may be as much as 100 feet from x in 
  415. any direction.  GPS has the inherent capability of locating points within 
  416. approximately 50 feet of their actual position.  In deference to national 
  417. security, however, the Department of Defense applies a randomizing signal 
  418. called Selective Availability (SA) to the GPS system which decreases its 
  419. accuracy to within plus or minus 300 feet 95% of the time.  On the other 
  420. hand, GPS signals, because of their precision, appear to be very accurate.  
  421. The Meridian's GPGLL latitude/longitude output with 0.001 degree precision 
  422. incorrectly implies fixes accurate to six feet!  Plotting this data on the 
  423. MAPIT world of 100 foot squares is like trying to view super VGA data on an 
  424. old CGA display.  But one is quickly reminded that the data's apparent 6 
  425. foot accuracy is meaningless when the original reading is superimposed on a 
  426. second taken some time later.  The two readings from the same location may 
  427. be as much as 600 feet apart!  It is important to view all GPS data with a 
  428. 300 foot halo of uncertainty around it.
  429.  
  430. There are, however, methods of obtaining more accurate GPS fixes.  In what 
  431. might appear to be an internal turf war, the US Coast Guard is establishing 
  432. a series of transmitter sites along the coast broadcasting correction 
  433. signals which, when applied to differential GPS receivers, more than 
  434. compensate for the DOD induced SA, a great boon to boat owners!  Similarly, 
  435. surveying GPS units use locally generated correction signals transmitted 
  436. from a known point to achieve truly remarkable accuracy within a limited 
  437. area.
  438.